import request from '../config/request.js';
import host from '../config/host';

// 获取生产数据详情
const getProduceDetail= function(data,callback,error){
	request.postData(
		host.hostUrl + '/productFillData/detail',
		data,
		callback,
		error
	);
}

// 获取生产数据列表
const getProduceList= function(param,callback){
	request.postData(
		host.hostUrl + '/productFillData/list',
		param,
		callback
	);
}

// 添加或编辑生产数据
// const addOrEditProduceDetail= function(param,callback){
// 	request.postData(
// 		host.hostUrl + '/productFillData/saveOrEdit',
// 		param,
// 		callback
// 	);
// }
const postProduceDetail= function(param,callback){
	request.postData(
		host.hostUrl + '/productFillData/save',
		param,
		callback
	);
}

const putProduceDetail= function(param,callback){
	request.postData(
		host.hostUrl + '/productFillData/update',
		param,
		callback
	);
}

// 获取企业部门工艺系列配置
const getProduceConfig= function(dep, callback){
	request.getData(
		host.hostUrl + `/productFillData/config/${dep}`,
		callback
	);
}

// 获取企业部门工艺系列配置
const getJobList= function(callback){
	request.getData(
		host.hostUrl + '/productFillData/listOrgJobShift',
		callback
	);
}
// 生产日报列表
const getDailyReportList= function(data,callback){
	request.postData(
		host.hostUrl + '/productDailyReport/listDailyReport',
		data,
		callback
	);
}
// 日报汇总列表
const getDailyReportDetailList= function(data,callback){
	request.postData(
		host.hostUrl + '/productDailyReport/listDailyReportDetail',
		data,
		callback
	);
}
// 日报汇总已读未读
const postDailyReportDetailRaed= function(data,callback){
	request.postData(
		host.hostUrl + '/productDailyReport/viewDailyReportDetail',
		data,
		callback
	);
}
// 日报汇总详情数据
const postDailyReportDetailFillData= function(data,callback){
	request.postData(
		host.hostUrl + '/productDailyReport/fillData',
		data,
		callback
	);
}
// 日报汇总详情数据
const postDailyReportDetail= function(id,callback,error){
	request.getData(
		host.hostUrl + `/productDailyReport/detailDailyReport/${id}`,
		callback,
		error
	);
}
// 日报额外tab页
const postDailyReportDetailExtraTabs= function(reportId,callback){
	request.getData(
		host.hostUrl + `/productDailyReport/dailyReportExtraTabs/${reportId}`,
		callback
	);
}
// 驳回
const postDailyReportReject = function(data,callback){
	request.postData(
		host.hostUrl + `/productFillData/reject`,
		data,
		callback
	);
}
// 自动填报
const getFillData = function(data,callback){
	request.postData(
		host.hostUrl + `/productFillData/getFillData`,
		data,
		callback
	);
}
// 自动填报
const getFillDepartment = function(callback){
	request.getData(
		host.hostUrl + `/productFillData/findDepartment`,
		callback
	);
}

export default {
	getProduceDetail,
	getProduceList,
	postProduceDetail,
	putProduceDetail,
	getProduceConfig,
	getJobList,
	getDailyReportList,
	getDailyReportDetailList,
	postDailyReportDetail,
	postDailyReportDetailRaed,
	postDailyReportDetailFillData,
	postDailyReportDetailExtraTabs,
	postDailyReportReject,
	getFillData,
	getFillDepartment,
}
